package com.zh.mycommon.value;

/**
 * 常用常量定义
 *
 * @author ZH
 * @date 18:08 2022/1/21
 */
public final class RegexConst {
    private RegexConst(){}

    //常用正则
    public static final String REGEX_EMAIL = "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?";
    public static final String REGEX_EMAIL_OLD = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";
    public static final String REGEX_PHONE = "^1\\d{10}$";
    public static final String REGEX_PASSWORD = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z_-]{4,16}$";

    /**
     * int整数
     */
    public static final String REGEX_INTEGER = "^(-?\\d+)$";

    /**
     * double数字
     */
    public static final String REGEX_NUMBER = "^(-?\\d+)(.?\\d{1,9})(?!.)$";

    /**
     * double正数
     */
    public static final String REGEX_NUMBER_POSITIVE = "^\\d+(.?\\d{1,9})(?!.)$";

    /**
     * double负数
     */
    public static final String REGEX_NUMBER_NEGATIVE = "^-\\d+(.?\\d{1,9})(?!.)$";

    //HTML相关
    public static final String REGEX_STYLE = "<style[^>]*?>[\\s\\S]*?<\\/style>";      //定义style的正则表达式
    public static final String REGEX_SCRIPT = "<script[^>]*?>[\\s\\S]*?<\\/script>";   //定义script的正则表达式
    public static final String REGEX_HTML = "<[^>]+>";                                 //定义HTML标签的正则表达式
    public static final String REGEX_URL = "(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";

    //Markdown相关
    public static final String REGEX_TAG = "(!?\\[[^]]+])";
    public static final String REGEX_MARKDOWN_SYMBOL = "#|\\+|-|_|~|\\*|(```)";
    public static final String REGEX_MARKDOWN_URL = "!\\[(.*?)\\]\\((http[s]?://.*?)\\)";

    public static final String REGEX_IP = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$";
    public static final String REGEX_IP_PORT = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\:(\\d{1,5})$";

}
